ActionController::Routing::Routes.draw do |map|

  # The priority is based upon order of creation: first created -> highest
  # priority.

  map.connect 'contacts/do_subscribe', :controller => 'contacts',
    :action => 'do_subscribe', :conditions => { :method => :post }

  map.subscribe 'subscribe', :controller => 'contacts', :action => 'subscribe'
  map.unsubscribe 'unsubscribe/:token', :controller => 'contacts',
    :action => 'unsubscribe'
  map.activate_subscription 'activate_subscription/:token', :controller => 'contacts',
    :action => 'activate'

  map.activate '/activate/:activation_code', :controller => 'users',
    :action => 'activate'

  map.signup '/signup', :controller => 'users', :action => 'new'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.logout '/logout', :controller => 'sessions', :action => 'destroy'

  map.resources :contacts
  map.resources :newsletters, :member => { 
    :publish => :get,
    :send_preview => :put,
  }
  map.resources :users
  map.resource :session
  
  map.root :controller => 'index', :action => 'index'
  map.admin '/admin', :controller => 'index', :action => 'admin'

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible
  # via GET requests. You should consider removing the them or commenting
  # them out if you're using named routes and resources.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end
